﻿using System;
using Com.OpenCode.Framework.Core;
using Com.OpenCode.Framework.DevForm;

namespace Com.OpenCode.Framework.Workbench
{
    public class DockDoozer : IDoozer
    {
        public object BuildItem(BuildItemEventArgs args)
        {
            object obj = null;
            try
            {
                string _TypeName = args.Plugin.Properties.Get("Type").ToString();
                if (WorkbenchActivator.CheckCondition(args.Plugin))
                {
                    switch (_TypeName)
                    {
                        case "Panel":
                            obj = new DockPanelUI(args);
                            break;
                        case "Document":
                            obj = new DocumentUI(args);
                            break;
                    }
                }
            }
            catch (Exception ex)
            {
                LogServices.WriteError(ex.Message);
            }
            return obj;
        }

        public string Name
        {
            get { return "Dock"; }
        }
    }
}